﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AuthorityPage.aspx.cs"
    Inherits="Torch.WL.Web.Admin.Modubles.AuthorityPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../../../Inc/Style/<%=Request.Cookies["UIStyle"].Value%>/css/indexControl.css"
        rel="stylesheet" type="text/css" />

    <script src="../../../Inc/Script/pub.js" type="text/javascript"></script>

    <link href="../../../resources/css/Framework.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript">

        //新增数据合法性检测
        function CheckAdd() {
            var ret = true;

            if ($id("txt_name").value == "") {
                alert('请输入名称');
                ret = false;
            }
            else if ($id("txt_Tag").value == "") {
                alert('请输入标识');
                ret = false;
            }
            else if ($id("txt_order").value == "") {
                alert('请输入排序编号');
                ret = false;
            }
            else if (!IsPlusInt($id("txt_order").value)) {
                alert('排序编号必须为数字');
                ret = false;
            }
            return ret;
        }
        
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div id="divToolBar" class="topBar">
        <div class="toolBar">
        </div>
        <div class="moduleName">
            权限管理</div>
    </div>
    <div class="w_wrapper w_marginTop">
        <div class="w_header">
            <div class="w_inputArea">
                <label>名称：</label>
                <asp:TextBox ID="txt_Name" Width="80" MaxLength="30" CssClass="w_text" runat="server"></asp:TextBox>
                标识：
                <asp:TextBox ID="txt_Tag" CssClass="w_text" runat="server"></asp:TextBox>
                说明：
                <asp:TextBox ID="txt_Description" CssClass="w_text" runat="server"></asp:TextBox>
                排序：
                <asp:TextBox ID="txt_order" CssClass="w_text" Width="30px" runat="server" onkeypress="return event.keyCode>=48&&event.keyCode<=57"
                    onpaste="return !clipboardData.getData('text').match(/\D/)"></asp:TextBox>
                <asp:Button ID="btn_add" CssClass="w_button" runat="server" Text="新增" OnClick="btn_add_Click" /></div>
            <div id="strinfo" runat="server" class="w_info" visible="false">
            </div>
        </div>
        <div class="w_content">
            <asp:GridView ID="AuthorityLists" runat="server" DataKeyNames="AuthorityID" CssClass="w_table"
                AllowSorting="True" OnRowCommand="AuthorityLists_RowCommand" OnRowDataBound="AuthorityLists_RowDataBound"
                AllowPaging="True" OnPageIndexChanging="AuthorityLists_PageIndexChanging" PageSize="15"
                AutoGenerateColumns="False" OnRowCancelingEdit="AuthorityLists_RowCancelingEdit"
                OnRowEditing="AuthorityLists_RowEditing" OnRowUpdating="AuthorityLists_RowUpdating" GridLines="None">
                <Columns>
                    <asp:BoundField DataField="AuthorityID" HeaderText="编号" ReadOnly="True">
                        <ItemStyle HorizontalAlign="Center" Wrap="false" />
                        <HeaderStyle HorizontalAlign="Center" Wrap="false" Width="60px" />
                    </asp:BoundField>
                    <asp:TemplateField HeaderText="名称">
                        <ItemTemplate>
                            <asp:Label ID="Lab_name" runat="server" Text='<%# Eval("AuthorityName") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txt_name" Width="120" MaxLength="30" CssClass="w_text" runat="server"
                                Text='<%# Eval("AuthorityName") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemStyle HorizontalAlign="Left" Wrap="False" />
                        <HeaderStyle HorizontalAlign="Center" Wrap="false" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="标识">
                        <ItemTemplate>
                            <asp:Label ID="Lab_tag" runat="server" Text='<%# Eval("AuthorityTag") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txt_tag" Width="120" MaxLength="30" CssClass="w_text" runat="server"
                                Text='<%# Eval("AuthorityTag") %>' ReadOnly="true"></asp:TextBox><!--不允许修改标识-->
                        </EditItemTemplate>
                        <ItemStyle HorizontalAlign="Left" Wrap="False" />
                        <HeaderStyle HorizontalAlign="Center" Wrap="false" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="说明">
                        <ItemTemplate>
                            <asp:Label ID="Lab_Description" runat="server" Text='<%# Eval("AuthorityDescription") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txt_Description" Width="120" MaxLength="30" CssClass="w_text" runat="server"
                                Text='<%# Eval("AuthorityDescription") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemStyle HorizontalAlign="Left" Wrap="False" />
                        <HeaderStyle HorizontalAlign="Center" Wrap="false" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="排序">
                        <ItemTemplate>
                            <asp:Label ID="lab_order" runat="server" Text='<%# Eval("AuthorityOrder") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txt_order" Width="30" MaxLength="3" CssClass="w_text" onkeypress="return event.keyCode>=48&&event.keyCode<=57"
                                onpaste="return !clipboardData.getData('text').match(/\D/)" runat="server" Text='<%# Eval("AuthorityOrder") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemStyle HorizontalAlign="Center" Wrap="False" />
                        <HeaderStyle HorizontalAlign="Center" Wrap="false" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="编辑" ShowHeader="False">
                        <ItemTemplate>
                            <asp:LinkButton ID="btn_Edit" runat="server" CausesValidation="False" CommandName="Edit"
                                Text="编辑" CommandArgument='<%# Eval("AuthorityID")%>'></asp:LinkButton>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:LinkButton ID="btn_update" runat="server" CausesValidation="True" CommandName="Update"
                                Text="更新"></asp:LinkButton>
                            &nbsp;<asp:LinkButton ID="btn_cancel" runat="server" CausesValidation="False" CommandName="Cancel"
                                Text="取消"></asp:LinkButton>
                        </EditItemTemplate>
                        <ItemStyle HorizontalAlign="Center" Wrap="False" />
                        <HeaderStyle HorizontalAlign="Center" Wrap="false" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="删除" ShowHeader="False">
                        <ItemTemplate>
                            <asp:LinkButton ID="btn_del" runat="server" CausesValidation="False" CommandName="Del"
                                Text="删除" CommandArgument='<%# Eval("AuthorityID")%>'></asp:LinkButton>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" Wrap="False" />
                        <HeaderStyle HorizontalAlign="Center" Wrap="false" />
                    </asp:TemplateField>
                </Columns>
                <HeaderStyle CssClass="header" />
                <AlternatingRowStyle BorderStyle="None" CssClass="w_trEven" />
            </asp:GridView>
            <div id="GridViewMsg" style="padding: 5px;" runat="server">
            </div>
        </div>
    </div>
    </form>
</body>
</html>
